From a0abdbbdd6a83db2a51fcd390472f177436b35ca Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 1 Sep 2014 18:44:48 +0200 Subject: [PATCH] wayland: Reference pixmap-based cursors' surface before handing the wl_buffer cairo_surface_destroy() is called after the buffer is released, for every wl_buffer. Windows usually reference their cairo surface before rendering, so that extra reference is consumed after the buffer is released, so do the same with cursor surfaces and add an extra reference whenever a cursor surface change is about to be scheduled. Otherwise, the GdkWaylandCursor is left with an invalid cairo_surface_t, which causes crashes the next time it is used. https://bugzilla.gnome.org/show_bug.cgi?id=735830 --- gdk/wayland/gdkcursor-wayland.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c index 6702ce71ca..b247fad6b3 100644 --- a/gdk/wayland/gdkcursor-wayland.c +++ b/gdk/wayland/gdkcursor-wayland.c @@ -179,6 +179,8 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor, *h = wayland_cursor->surface.height / wayland_cursor->surface.scale; *scale = wayland_cursor->surface.scale; + cairo_surface_reference (wayland_cursor->surface.cairo_surface); + if (wayland_cursor->surface.cairo_surface) return _gdk_wayland_shm_surface_get_wl_buffer (wayland_cursor->surface.cairo_surface); else -- 2.30.2